//
//  EXT+UILabel.swift
//  新浪微博
//
//  Created by 季伯文 on 2017/6/29.
//  Copyright © 2017年 bowen. All rights reserved.
//

import UIKit

extension UILabel {
    
    convenience init(text: String?, textColor: UIColor, fontSize: CGFloat, maxWeight: CGFloat = 0){
        self.init()
        
        self.text = text
        self.textColor = textColor
        self.font = UIFont.systemFont(ofSize: fontSize)
        
        //判断maxWight是否大于0
        if maxWeight > 0 {
            //如果设置了最大宽度 说明需要换行
            self.preferredMaxLayoutWidth = maxWeight
            self.numberOfLines = 0
        }
    }
}
